package com.mxchip.livestarmobile.mobile.ui.mine

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.mxchip.livestarmobile.R
import com.mxchip.livestarmobile.mobile.ui.login.WebViewFragment
import com.mxchip.livestarmobile.mobile.util.Utils
import kotlinx.android.synthetic.main.fragment_about.*
import kotlinx.android.synthetic.main.fragment_mine.text_hxb_number4

class AboutFragment : Fragment() {


    override fun onCreateView(inflater: LayoutInflater,
                              container: ViewGroup?, savedInstanceState: Bundle?): View? {

        return inflater.inflate(R.layout.fragment_about, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        view_service.setOnClickListener {
            val action = AboutFragmentDirections.actionAboutToWebView()
            action.showWebView = "service_agreement.html"
            action.webViewTitle = text_service.text.toString()
            findNavController().navigate(action)
        }

        view_privacy.setOnClickListener {
            val action = AboutFragmentDirections.actionAboutToWebView()
            action.showWebView = "privacy_policy.html"
            action.webViewTitle = text_privacy.text.toString()
            findNavController().navigate(action)

        }

    }

    override fun onResume() {
        super.onResume()
        text_hxb_number4.text = Utils.getVersionName(context)
    }
}